﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common;
using System.Collections;

namespace AdminUI.Controllers
{
    public class TemplateController : BaseController
    {
        // GET: Template
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Add()
        {
            return PartialView();
        }
        public ActionResult Edit(int? id)
        {
            if (!id.HasValue)
            {
                return View("error");
            }
            var cate = HttpHelper.HttpGet<Result<List<LevelClass>>>(Tools.ApiPath + "api/TemplateClassify/LevelClass", "get").Data;
            ViewBag.Cate = cate;
            var data = HttpHelper.HttpGet<Result<Param_Template>>(Tools.ApiPath + "api/Template/FindByID/" + id.Value, "get").Data;
            return PartialView(data);
        }


        public ActionResult Content()
        {
            return View();
        }

        public ActionResult DetailAll(int? id)
        {
            if (!id.HasValue)
            {
                return View("error");
            }
            var data=  HttpHelper.HttpGet<Result<Full_Template>>(Tools.ApiPath+ "api/Template/GetFullTemplate/"+id,"get");
            ////基本信息和自定义信息
            //var BasicInform = HttpHelper.HttpGet<Result<BasicInform_and_BasicInformCus>>(Tools.ApiPath + "api/BasicInformation/FindByTemplateID/" + id, "get");

            ////通过模板ID得到相对应的教育经历，工作经历，项目经验，校园经历，实习经历这个表
            //var Experience = HttpHelper.HttpGet<Result<List<Param_Experience>>>(Tools.ApiPath + "api/ExperienceDetail/GetDataByTemplateID/" + id, "get");

            ////自定义经历
            //var Custom = HttpHelper.HttpGet<Result<List<Param_Custom>>>(Tools.ApiPath + "Api/CustomDetails/GetCustomByTemplateID/" + id, "get");

            ////通过模板ID得到工作意向数据
            //var JobIntention = HttpHelper.HttpGet<Result<Param_JobIntention>>(Tools.ApiPath + "api/JobIntention/FindByTemplateID/" + id, "get");
            if (data.Code==200)
            {
                ViewBag.data = data.Data;
                return View();
            }
            return View("error");
        }
    }
}